﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public class MyTableAdapter
{
    private DataTable _dt;
    private int _vic;

    //this is the constructor that takes as parameters a cute little datatable

    // with the right 10 records, an an integer vic = virtualitemcount

    public MyTableAdapter(DataTable dt)
    {
        try
        {
            _dt = dt;
            _vic = Convert.ToInt32(dt.Rows[0]["TotalRows"]);
        }
        catch
        {
            _dt = null;
            _vic = 0;
        }
    }

    //this returns the datatable (10 records)

    public DataTable GetData()
    {
        return _dt;
    }

    //this returns the total number of records in the table (30.000)

    public int VirtualItemCount()
    {
        return _vic;
    }

    //this also returns the datatable (10 records) but the ODS needs it for paging purposes

    public DataTable GetData(int startRow, int maxRows)
    {
        return _dt;
    }
}
